home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tttdem51.zip / WINDEM3.PAS < prev   
Pascal/Delphi Source File  |  1989-01-31  |  4KB  |  90 lines

  1. Program WinTTT5_Demo_3;
  2. {
  3.  This program is designed to illustrate the power of the FastTTT and
  4.  WinTTT units. The demo code has been designed to illustrate the ways in
  5.  which the Toolkit procedure and functions can be included in your programs.
  6.  The program itself has no real prurpose other than to flash various info
  7.  onto the screen.
  8. }
  9.  
  10. Uses DOS,CRT,FastTTT5,WinTTT5,KeyTTT5;  { As a habit, I always USE the DOS   }
  11.                                         { and CRT units as well as the Tool- }
  12.                                         { kit units. KeyTTT is also included }
  13.                                         { because I will be including the    }
  14.                                         { GetKey function.                   }
  15.  
  16.  Procedure Welcome;
  17.  { paints an introduction screen }
  18.  begin
  19.      CreateScreen(3,25);
  20.      Activate_Virtual_Screen(3);   {all subsequent writes will be to screen 3}
  21.      ClearText(1,1,80,25,white,blue);   { Clear the screen with a blue background }
  22.      WriteCenter(1,white,blue,'FASTTTT and WINTTT Demonstration');  { write in middle of line 1}
  23.      FBox(20,5,61,15,white,red,1);      { draw a single line filled box }
  24.      WriteAT(22,7,white,red,'This demo is designed to illustrate');
  25.      WriteAT(22,8,white,red,'the features of the FastTTT and WinTTT');
  26.      WriteAT(22,9,white,red,'units.');
  27.      WriteAT(22,11,white,red,'While you have been reading this, two');
  28.      WriteAT(22,12,white,red,'other screens have been written on the');
  29.      WriteAT(22,13,white,red,'heap.');
  30.      Activate_Visible_Screen;
  31.  end;  {proc Welcome}
  32.  
  33.  Procedure Prepare_Virtual_Screen_1;
  34.  { allocates a new screen on the heap and writes text to it }
  35.  begin
  36.     CreateScreen(1,25);              {create a new screen - referred to as screen 1}
  37.     Activate_Virtual_Screen(1);   {all subsequent writes will be to screen 1}
  38.     ClearText(1,1,80,25,yellow,Green); {clear the screen on the heap}
  39.     WriteCenter(1,white,green,'Virtual Screens'); {write a heading in the center of line 1}
  40.     HorizLine(15,65,2,white,green,2);   {draw a double line}
  41.     PlainWrite(10,4,'Virtual screens have all the characteristics of the visible');
  42.     PlainWrite(10,5,'screen. The main advantage of virtual screens is that they can');
  43.     PlainWrite(10,6,'be prepared while the user is viewing a different image.');
  44.     PlainWrite(10,8,'They are very useful for preparing help screens that may, or');
  45.     PlainWrite(10,9,'may not, be displayed. This screen was prepared while you');
  46.     PlainWrite(10,10,'were viewing the welcome screen.');
  47.     GotoXY(43,10);                {GotoXY works on virtual screens as well}
  48.     Activate_Visible_Screen;      {set subsequent writes to the visble screen}
  49.  end; { Prepare_Virtual_Screen_1}
  50.  
  51.  Procedure Prepare_Virtual_Screen_2;
  52.  { allocates a new screen on the heap and writes text to it }
  53.  begin
  54.     CreateScreen(2,25);                {create a new screen - referred to as screen 2}
  55.     Activate_Virtual_Screen(2);     {all subsequent writes will be to screen 2}
  56.     ClearText(1,1,40,25,white,red); {clear the screen on the heap}
  57.     ClearText(41,1,80,25,black,lightgray); {clear the screen on the heap}
  58.     PlainWrite(28,1,'This was written with Plainwrite');  {use default display colors}
  59.     Fillscreen(10,5,25,10,white,red,'*');
  60.     CopyScreenBlock(10,5,25,10,50,15);  {the copy and move operations work on the virtual screen}
  61.     CopyScreenBlock(10,5,25,10,10,15);  {the copy and move operations work on the virtual screen}
  62.     MoveScreenBlock(10,15,25,20,30,18);
  63.     Activate_Visible_Screen;      {set subsequent writes to the visble screen}
  64.  end; { Prepare_Virtual_Screen_1}
  65.  
  66.  Procedure Press_A_Key;
  67.  {display a message in a single lined box}
  68.  begin
  69.      DelayKey(2000);
  70.      TempMessageBox(54,23,black,cyan,1,'Press any key to continue');
  71.  end;
  72.  
  73. begin    {main program}
  74.     W_fatal := true;  {the program will halt if WinTTT has serious error}
  75.     ClrScr;
  76.     Welcome;
  77.     SlideRestoreScreen(3,Up);
  78.     Prepare_Virtual_Screen_1;
  79.     Prepare_Virtual_Screen_2;
  80.     Press_A_key;
  81.     RestoreScreen(1);      {Display screen 1 that was created on the heap}
  82.     Press_A_key;
  83.     RestoreScreen(2);
  84.     Press_A_Key;
  85.     DisposeScreen(1);      {release the heap space taken by the screens}
  86.     DisposeScreen(2);
  87.     DisposeScreen(3);
  88.     Reset_StartUp_Mode;
  89. end.
  90.